<%@ tag description="People List Template" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="joda" uri="http://www.joda.org/joda/time/tags"%>
<%@ attribute name="list" required="true" type="java.lang.Iterable"%>

<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/css/master.css" />">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/css/staff.css" />">

<c:url value="/static/img/photo" var="imageFolderUrl" />
<c:url value="/donations" var="donationsUrl" />

<c:choose>
	<c:when test="${list != null && !empty list}">
		<table id="staff" class="table table-hover">
			<thead>
				<tr>
					<th>Photo</th>
					<th>Description</th>
					<th>Donations</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${list}" var="person">
					<tr>
						<td><a href="${donationsUrl}/${person.id}.html"> <img
								class="photo_small" alt="${person.firstName} ${person.lastName}"
								src="${imageFolderUrl}/${person.photoPath}" />
						</a></td>
						<td>
							<dl>
								<dt>First name</dt>
								<dd>${person.firstName}</dd>
								<c:if
									test="${person.middleName != null && not empty person.middleName}">
									<dt>Middle name</dt>
									<dd>${person.middleName}</dd>
								</c:if>
								<dt>Last name</dt>
								<dd>${person.lastName}</dd>
								<dt>Birthday</dt>
								<dd>
									<joda:format value="${person.birthday}" pattern="dd.MM.yyyy" />
								</dd>
							</dl>
						</td>
						<td><a class="btn" href="${donationsUrl}/${person.id}.html">Open</a>
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</c:when>
	<c:otherwise>
		<p class="empty">Nobody here</p>
	</c:otherwise>
</c:choose>

